]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
signalTracker: Avoid creating a temporary keys array when clearing
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Wed, 6 Jul 2022 15:47:14 +0000 (17:47 +0200)
committerMarco Trevisan (Treviño) <mail@3v1n0.net>
Wed, 6 Jul 2022 16:24:08 +0000 (18:24 +0200)
We used to create a temporary array of signal tracker keys and then to
iterate through them in order to untrack the objects, but the Map's can
be iterated directly so let's just use their native forEach.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2366>

js/misc/signalTracker.js

index 30d19a27f6c5557cd846d448bd6e8b425717ffa4..e01bec5b12f235c726a461f2c02f6d724f28f801 100644 (file)
@@ -138,7 +138,7 @@ class SignalTracker {
      * @returns {void}
      */
     clear() {
-        [...this._map.keys()].forEach(obj => this.untrack(obj));
+        this._map.forEach((_, obj) => this.untrack(obj));
     }
 
     /**